package com.javabasic.algorithm.leetcode;

/**
 * @author mir.xiong
 * @version 1.0
 * @description
 * @see
 * @since Created by work on 2022/6/21 20:41
 */
public class DefangingAnIPAddress {

    /**
     * 暴力解法
     * @param address
     * @return
     */
    public String defangIPaddr(String address) {
        String[] split = address.split("\\.");
        StringBuffer buffer = new StringBuffer();
        int len = split.length;
        for (int i = 0; i < len; i++) {
            buffer.append(split[i]);
            if (i != len-1) {
                buffer.append("[.]");
            }
        }

        return buffer.toString();
    }

}
